feat(commander): uncommanded altitude loss detection with parachute f…#26837
Merged
feat(commander): uncommanded altitude loss detection with parachute f…#26837
Conversation
e340af4 to
91a4720
Compare
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 752 byte (0.04 %)]px4_fmu-v6x [Total VM Diff: 744 byte (0.04 %)]Updated: 2026-03-30T09:38:55 |
MaEtUgR
reviewed
Mar 27, 2026
8fea79c to
68e47df
Compare
bresch
requested changes
Apr 10, 2026
Member
bresch
left a comment
There was a problem hiding this comment.
Did you check if this also doesn't trigger when the EKF does an altitude reset?
Member
|
Could you maybe take the opportunity to add a unit test for this? |
…ailsafe Detects when a rotary-wing vehicle drops more than FD_ALT_LOSS metres below a NED-z reference while altitude control is active, and immediately triggers flight termination (parachute deployment). Detection (FailureDetector): - FD_ALT_LOSS: drop threshold in metres (0 = disabled, default) - FD_ALT_LOSS_T: hysteresis time - Guards: rotary-wing only, altitude control active, z_valid, setpoint fresh (<1 s). Manual, Acro and FW/VTOL-FW modes are excluded. - Ratcheting reference: initialises to lpos.z on first sample below setpoint, preventing false triggers on new waypoints Failsafe action (commander): - New fd_alt_loss flag in FailsafeFlags.msg - COM_ALT_LOSS_ACT: -1=Disabled (default), 0=Terminate - Terminate fires immediately, cannot be overridden, and never clears until disarm (parachute deployment is irreversible)
68e47df to
8542f09
Compare
src/modules/commander/failure_detector/FailureDetectorAltitudeLossTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/commander/failure_detector/FailureDetectorAltitudeLossTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/commander/failure_detector/FailureDetectorAltitudeLossTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/commander/failure_detector/FailureDetectorAltitudeLossTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/commander/failure_detector/FailureDetectorAltitudeLossTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/commander/failure_detector/FailureDetectorAltitudeLossTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/commander/failure_detector/FailureDetectorAltitudeLossTest.cpp
Outdated
Show resolved
Hide resolved
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 840 byte (0.04 %)]px4_fmu-v6x [Total VM Diff: 928 byte (0.05 %)]Updated: 2026-04-13T11:35:32 |
8542f09 to
9461b37
Compare
9461b37 to
9ac4ff0
Compare
bresch
approved these changes
Apr 13, 2026
Member
bresch
left a comment
There was a problem hiding this comment.
Looks good, thanks for the unit tests!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solved Problem
Rotary-wing vehicles with a parachute system have no dedicated failsafe
for uncommanded altitude loss (e.g. motor failure, structural failure).
The existing
fd_critical_failurepath covers attitude limits andexternal ATS, but not altitude drop while the vehicle is still
attitude-stable. This PR adds that missing detection path.
Solution
FailureDetector::updateAltitudeStatusis called each cycle whenattitude control is active. It compares
vehicle_local_position.zagainst
vehicle_local_position_setpoint.zusing a ratchetingreference that tracks the highest altitude reached while below the
setpoint. When the drop exceeds
FD_ALT_LOSSforFD_ALT_LOSS_Tseconds,
failure_detector_status.flags.altis set, which propagatesto
FailsafeFlags.fd_alt_lossand triggersAction::Terminatein thefailsafe framework. Commander then sets
actuator_armed.termination = trueand callssend_parachute_command()on the rising edge.Changelog Entry
New feature: uncommanded altitude loss detection for rotary-wing vehicles.
When FD_ALT_LOSS > 0, a drop exceeding the threshold while altitude
control is active immediately triggers flight termination and parachute
deployment via COM_ALT_LOSS_ACT.
New parameters: FD_ALT_LOSS, FD_ALT_LOSS_T, COM_ALT_LOSS_ACT
Test coverage
make px4_sitl_default,make px4_fmu-v6x_defaultmake tests TESTFILTER=failsafe_test